﻿using System;
namespace Producers.Rr.Xtee.Riik.Ee.Producer.Rr {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="RR75Response", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RR75Response))]
    public class RR75ResponseSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected IRR75Response clazz;
        
        public RR75ResponseSerializer(IRR75Response clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            Writer.WriteStartElement("outIsikukood");
            if (clazz.OutIsikukood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutIsikukood))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutIsikukood");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outPerenimi");
            if (clazz.OutPerenimi!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutPerenimi))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutPerenimi");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outEesnimi");
            if (clazz.OutEesnimi!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutEesnimi))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutEesnimi");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outMK");
            if (clazz.OutMK!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutMK))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutMK");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outMKnimi");
            if (clazz.OutMKnimi!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutMKnimi))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutMKnimi");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outVK");
            if (clazz.OutVK!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutVK))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutVK");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outVKnimi");
            if (clazz.OutVKnimi!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutVKnimi))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutVKnimi");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outAK");
            if (clazz.OutAK!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutAK))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutAK");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outAKnimi");
            if (clazz.OutAKnimi!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutAKnimi))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutAKnimi");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outTanav");
            if (clazz.OutTanav!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutTanav))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutTanav");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outMaja");
            if (clazz.OutMaja!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutMaja))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutMaja");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outKorter");
            if (clazz.OutKorter!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutKorter))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutKorter");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outAadrTXT");
            if (clazz.OutAadrTXT!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutAadrTXT))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutAadrTXT");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outinfo");
            if (clazz.Outinfo!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Outinfo))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Outinfo");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("poiVeaKood");
            Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "integer");
            Writer.WriteString(new global::Xtee.Core.Schema.XsdInteger(((decimal)(clazz.PoiVeaKood))).ToString());
            Writer.WriteEndElement();
            Writer.WriteStartElement("pocVeaTekst");
            if (clazz.PocVeaTekst!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.PocVeaTekst))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : PocVeaTekst");
            }
            Writer.WriteEndElement();
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
            if (Reader.LocalName=="outIsikukood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR75Response>outIsikukood");
                }
                clazz.OutIsikukood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outIsikukood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR75Response>outIsikukood", Reader.LocalName);
            }
            if (Reader.LocalName=="outPerenimi") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR75Response>outPerenimi");
                }
                clazz.OutPerenimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outPerenimi")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR75Response>outPerenimi", Reader.LocalName);
            }
            if (Reader.LocalName=="outEesnimi") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR75Response>outEesnimi");
                }
                clazz.OutEesnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outEesnimi")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR75Response>outEesnimi", Reader.LocalName);
            }
            if (Reader.LocalName=="outMK") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR75Response>outMK");
                }
                clazz.OutMK = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outMK")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR75Response>outMK", Reader.LocalName);
            }
            if (Reader.LocalName=="outMKnimi") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR75Response>outMKnimi");
                }
                clazz.OutMKnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outMKnimi")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR75Response>outMKnimi", Reader.LocalName);
            }
            if (Reader.LocalName=="outVK") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR75Response>outVK");
                }
                clazz.OutVK = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outVK")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR75Response>outVK", Reader.LocalName);
            }
            if (Reader.LocalName=="outVKnimi") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR75Response>outVKnimi");
                }
                clazz.OutVKnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outVKnimi")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR75Response>outVKnimi", Reader.LocalName);
            }
            if (Reader.LocalName=="outAK") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR75Response>outAK");
                }
                clazz.OutAK = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outAK")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR75Response>outAK", Reader.LocalName);
            }
            if (Reader.LocalName=="outAKnimi") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR75Response>outAKnimi");
                }
                clazz.OutAKnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outAKnimi")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR75Response>outAKnimi", Reader.LocalName);
            }
            if (Reader.LocalName=="outTanav") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR75Response>outTanav");
                }
                clazz.OutTanav = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outTanav")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR75Response>outTanav", Reader.LocalName);
            }
            if (Reader.LocalName=="outMaja") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR75Response>outMaja");
                }
                clazz.OutMaja = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outMaja")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR75Response>outMaja", Reader.LocalName);
            }
            if (Reader.LocalName=="outKorter") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR75Response>outKorter");
                }
                clazz.OutKorter = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outKorter")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR75Response>outKorter", Reader.LocalName);
            }
            if (Reader.LocalName=="outAadrTXT") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR75Response>outAadrTXT");
                }
                clazz.OutAadrTXT = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outAadrTXT")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR75Response>outAadrTXT", Reader.LocalName);
            }
            if (Reader.LocalName=="outinfo") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR75Response>outinfo");
                }
                clazz.Outinfo = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outinfo")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR75Response>outinfo", Reader.LocalName);
            }
            if (Reader.LocalName=="poiVeaKood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR75Response>poiVeaKood");
                }
                clazz.PoiVeaKood = new global::Xtee.Core.Schema.XsdInteger(Reader.ReadElementString("poiVeaKood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR75Response>poiVeaKood", Reader.LocalName);
            }
            if (Reader.LocalName=="pocVeaTekst") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR75Response>pocVeaTekst");
                }
                clazz.PocVeaTekst = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("pocVeaTekst")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR75Response>pocVeaTekst", Reader.LocalName);
            }
        }
    }
}
